package com.jie.netty.im.tactics.factory;

import com.jie.constants.ChannelAttrKey;
import com.jie.netty.im.tactics.DisconnectionHandler;
import com.jie.netty.im.tactics.HeartbeatTimeoutHandler;
import com.jie.netty.im.tactics.impl.LoginDisconnectionHandler;
import com.jie.netty.im.tactics.impl.LoginHeartbeatTimeoutHandler;
import com.jie.netty.im.tactics.impl.RoomDisconnectionHandler;
import com.jie.netty.im.tactics.impl.RoomHeartbeatTimeoutHandler;

/**
 * 心跳超时处理工厂
 * @Author: 杰
 * @Project :net-disk
 * @DateTime: 2024/7/23 14:23
 **/
public class HeartbeatTimeoutFactory {
    public static HeartbeatTimeoutHandler createHeartbeatTimeoutHandler(String type){
        HeartbeatTimeoutHandler heartbeatTimeoutHandler=null;
        switch (type){
            case ChannelAttrKey.LOGIN_INFO:
                heartbeatTimeoutHandler=new LoginHeartbeatTimeoutHandler();
                break;
            case ChannelAttrKey.ROOM_ID:
                heartbeatTimeoutHandler=new RoomHeartbeatTimeoutHandler();
                break;
            default:
                break;
        }
        return heartbeatTimeoutHandler;
    }
}
